<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Tymon\JWTAuth\Contracts\JWTSubject;

class User extends Authenticatable implements JWTSubject
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password','openid', 'name', 'avatar', 'balance',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    public function getJWTIdentifier()
    {
        // TODO: Implement getJWTIdentifier() method.
        return $this->getKey();
    }

    public function getJWTCustomClaims()
    {
        // TODO: Implement getJWTCustomClaims() method.
        return [];
    }

    public function stores(): \Illuminate\Database\Eloquent\Relations\hasMany
    {
        return $this->hasMany('App\Store', 'uid', 'id');
    }
    public function storesInfo(): \Illuminate\Database\Eloquent\Relations\HasMany
    {
        return $this->hasMany('App\StoresInfo', 'uid', 'id');
    }
    public function subsidy(): \Illuminate\Database\Eloquent\Relations\HasMany
    {
        return $this->hasMany('App\Subsidy', 'uid', 'id');
    }
}
